{extend name="public/base" /}
{block name="body"}
<div class="ibox float-e-margins">
<div class="content-tabs">
	<ol class="breadcrumb">
		<li>
			<a href="{:url('index/index')}"><i class="fa fa-home"></i></a>
		</li>
		<li><strong>七日内产品销量统计</strong></li>
	</ol>
</div>
{include file="pro_enter/top"}

		<form id="myForm" class="form-horizontal m-t" method="post" action="{:url('index')}">
			<!--统计图-->
			<div id="main" style="width: 98%;height:500px;"></div>
       </form>    
	</div>
</div>
{/block} {block name="script"}
<script src="__JS__/jquery.form.js"></script>
<script src="__LIB__/validate/jquery.validate.min.js"></script>
<script src="__LIB__/validate/messages_zh.min.js"></script>
<script src="__LIB__/validate/add_validate.min.js"></script>
<script src="__LIB__/fileinput/js/fileinput.min.js"></script>
<script src="__LIB__/fileinput/js/locales/zh.js"></script>
<script src="__JS__/echarts.common.min.js"></script>
<style>
	.order-info .info-group{width:25%; text-align:center; float:left;}
	.order-info .info-group+.info-group{border-left:1px dotted #ccc; }
	.h4{font-size:22px; display:block;}
	
	
</style>
<script>
//导航
$("#li-bar-card").addClass("active");
var myChart = echarts.init(document.getElementById('main'));

var data1=[];
var data2=[];
	var arr = <?php echo json_encode($sum);?>;
	var aarr = eval(arr);
for(var i=0 ;i<aarr.length;i++){
	data1[i]=aarr[i].name;
	data2[i]=aarr[i].p;
}
updata(data1,data2);

function updata(p1,p2){
option = {
    color: ['#3398DB'],
    tooltip : {
        trigger: 'axis',
        axisPointer : {            // 坐标轴指示器，坐标轴触发有效
            type : 'shadow'        // 默认为直线，可选为：'line' | 'shadow'
        }
    },
    grid: {
        left: '3%',
        right: '4%',
        bottom: '3%',
        containLabel: true
    },
    toolbox: {
		feature: {
		    saveAsImage: {}
		}
    },
    xAxis : [
        {
            type : 'category',
            data : p1,
            axisTick: {
                alignWithLabel: true
            }
        }
    ],
    yAxis : [
        {
            type : 'value'
        }
    ],
    series : [
        {
            name:'产品销量',
            type:'bar',
            barWidth: '60%',
            data:p2
        }
    ]
	};
 myChart.setOption(option);
}
	   
</script>
{/block}